import { ElInput, ElSelect, ElOption } from "element-plus";
import { h } from "vue";

export const dataDirectoryColumns = [
    {
        align: "center",
        label: "数据目录分类",
        width: 220,
        prop: "dataCatalogClassification",
    },
    {
        align: "center",
        label: "数据主管部门",
        width: 220,
        prop: "dataSupervisoryDepartment",
    },
    {
        align: "center",
        label: "隶属系统",
        width: 220,
        prop: "affiliatedSystem",
    },
    {
        align: "center",
        label: "数据目录名称",
        width: 220,
        prop: "dataCatalogName",
    },
    {
        align: "center",
        label: "数据表中文名",
        width: 220,
        prop: "chineseTableName",
    },
    {
        align: "center",
        label: "数据表英文名",
        width: 220,
        prop: "englishTableName",
    },
    {
        align: "center",
        label: "信息项中文名",
        width: 220,
        prop: "chineseInfoItemName",
    },
    {
        align: "center",
        label: "信息项英文名",
        width: 220,
        prop: "englishInfoItemName",
    },
]
export const serviceFormRules = {
    serviceInterfaceName: [
        { required: true, message: "请输入服务接口名称", trigger: "blur" },
    ],
    serviceInterfaceCode: [
        { required: true, message: "请输入服务接口编码", trigger: "blur" },
    ],
    interfaceUniqueId: [
        { required: true, message: "请输入接口唯一标识", trigger: "blur" },
    ],
    api: [{ required: true, message: "请输入API", trigger: "blur" }],
    password: [{ required: true, message: "请输入密码", trigger: "blur" }],
    serviceInterfaceDesc: [
        { required: true, message: "请输入服务接口描述", trigger: "blur" },
    ],
    jsonDebug: [
        { required: true, message: "请输入json调试内容", trigger: "blur" },
    ],
    dataDiretory: [{ required: true, message: "请选择", trigger: "blur" }],
}
export const inputTableOptionColumns = [
    {
        align: "center",
        label: "参数名称",
        width: 220,
        prop: "paramterName",
        render: (row: any) => {
            return h(ElInput, {
                modelValue: row.paramterName,
                onInput: (value: any) => {
                    row.paramterName = value;
                },
            });
        },
    },
    {
        align: "center",
        label: "必选",
        width: 220,
        prop: "required",
        render: (row: any) => {
            return h(
                ElSelect,
                {
                    modelValue: row.required,
                    onInput: (value: any) => {
                        row.required = value;
                    },
                },
                [
                    h(ElOption, { label: "是", value: "1" }),
                    h(ElOption, { label: "否", value: "0" }),
                ]
            );
        },
    },
    {
        align: "center",
        label: "类型",
        width: 220,
        prop: "type",
        render: (row: any) => {
            const optionArr = [
                h(ElOption, { label: "String", value: "String" }),
                h(ElOption, { label: "Number", value: "Number" }),
                h(ElOption, { label: "Object", value: "Object" }),
                h(ElOption, { label: "Array", value: "Array" }),
            ];
            return h(
                ElSelect,
                {
                    modelValue: row.type,
                    onInput: (value: any) => {
                        row.type = value;
                    },
                },
                [...optionArr]
            );
        },
    },
    {
        align: "center",
        label: "描述",
        width: 220,
        prop: "paramterDescription",
        render: (row: any) => {
            return h(ElInput, {
                modelValue: row.paramterName,
                onInput: (value: any) => {
                    row.paramterName = value;
                },
            });
        },
    },
]
export const outPutTableOptionData = [
    {
        fieldDescription: "是否存在就诊记录",
        fieldName: "treatRecord",
        dataType: "VARCHAR2(1)",
        level: "1",
        required: "是",
        fieldExplanation: "对应业务代码集中的“是否标识代码”。",
    },
    {
        fieldDescription: "是否存在基本就诊信息",
        fieldName: "basicTreatInfo",
        dataType: "VARCHAR2(1)",
        level: "1",
        required: "是",
        fieldExplanation: "对应业务代码集中的“是否标识代码”。",
    },
    {
        fieldDescription: "基本就诊信息",
        fieldName: "treatInfos",
        dataType: "多个",
        level: "1",
        required: "有条件是",
        fieldExplanation:
            "如果医疗机构必须按照就诊唯一识别码查询就诊明细，则必传",
    },
    {
        fieldDescription: "业务类别",
        fieldName: "businessCategory",
        dataType: "VARCHAR2(2)",
        level: "2",
        required: "",
        fieldExplanation: "对应业务代码集中的“医联平台专属业务类别代a",
    },
]

export const outPutTableOptionColumns=[
    {
      align: "center",
      label: "字段描述",
      width: 220,
      prop: "fieldDescription",
    },
    { align: "center", label: "字段名称", width: 220, prop: "fieldName" },
    { align: "center", label: "数据类型", width: 220, prop: "dataType" },
    { align: "center", label: "层级", width: 80, prop: "level" },
    { align: "center", label: "必填", width: 100, prop: "required" },
    {
      align: "center",
      label: "字段说明",
      width: 420,
      prop: "fieldExplanation",
    },
  ]